package com.zhiyou.crud.service.impl;

import com.zhiyou.crud.bean.Manage;
import com.zhiyou.crud.bean.News;
import com.zhiyou.crud.bean.Question;
import com.zhiyou.crud.dao.ManageMapper;
import com.zhiyou.crud.dao.NewsMapper;
import com.zhiyou.crud.dao.QuestionMapper;
import com.zhiyou.crud.service.Admin_ManageService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: Admin_ManageServiceImpl
 * @Author: ZengS
 * @Date: 2022/9/24 17:15
 */
@Service
public class Admin_ManageServiceImpl implements Admin_ManageService {
    @Resource
    NewsMapper newsMapper;
    @Resource
    QuestionMapper questionMapper;
    @Resource
    ManageMapper manageMapper;
    @Override
    public List<News> getNews() {
        return newsMapper.selectAll();
    }

    @Override
    public void insertNews(News news) {
        newsMapper.insertSelective(news);
    }

    @Override
    public void updateNews(News news) {
        newsMapper.updateByPrimaryKeySelective(news);
    }

    @Override
    public void deleteNews(Integer nno) {
        newsMapper.deleteByPrimaryKey(nno);
    }

    @Override
    public List<Question> getQuestion() {
        return questionMapper.selectAll();
    }

    @Override
    public void insertQuestion(Question question) {
        questionMapper.insertSelective(question);
    }

    @Override
    public void deleteQuestion(Integer qno) {
        questionMapper.deleteByPrimaryKey(qno);
    }

    @Override
    public void updateQuestion(Question question) {
        questionMapper.updateByPrimaryKeySelective(question);
    }

    @Override
    public void updateManage(Manage manage) {
        manageMapper.updateByPrimaryKeySelective(manage);
    }
}
